# Contributor: Alexander Georgievskiy <galeksandrp@gmail.com>

_realname=3proxy
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
conflicts=("${MINGW_PACKAGE_PREFIX}-libproxy")
pkgver=0.8.13
pkgrel=1
pkgdesc='3proxy - tiny free proxy server (mingw-w64)'
arch=('any')
license=('BSD' 'Apache' 'GPL' 'LGPL')
url="https://github.com/z3APA3A/${_realname}"
source=(${_realname}-${pkgver}.tar.gz::"${url}/archive/${pkgver}.tar.gz")
sha256sums=('a6d3cf9dd264315fa6ec848f6fe6c9057db005ce4ca8ed1deb00f6e1c3900f88')

prepare() {
  cd ${srcdir}/${_realname}-${pkgver}
  mkdir -p bin
}

build() {
  cd ${srcdir}/${_realname}-${pkgver}

  make -f Makefile.win
}

package() {
  cd ${srcdir}/${_realname}-${pkgver}

  sed 's&$(INSTALL_BIN) -s $(INSTALL_OBJS) $(BINDIR)&$(INSTALL_BIN) -s bin/* $(BINDIR)&' -i Makefile.Linux
  make DESTDIR=${pkgdir} prefix=${MINGW_PREFIX} install -f Makefile.Linux
}
